package com.jzo2o.customer.controller.worker;


import com.jzo2o.common.constants.UserType;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 银行账户 前端控制器
 * </p>
 *
 * @author Echo
 * @since 2025-03-07
 */
@RestController("workerBankAccountController")
@RequestMapping("/worker/bank-account")
@RequiredArgsConstructor
@Api(tags = "服务端 - 银行账户信息相关接口")
public class BankAccountController {
    private final IBankAccountService bankAccountService;

    @PostMapping()
    @ApiOperation("添加银行账户")
    public void saveAccount(@RequestBody BankAccountUpsertReqDTO dto) {
        // 设置服务端用户类型
        dto.setType(UserType.WORKER);
        bankAccountService.saveAccount(dto);
    }

    @GetMapping("/currentUserBankAccount")
    @ApiOperation("根据服务人员id查询银行账户信息")
    public BankAccountResDTO queryByServeProviderId() {
        return bankAccountService.queryByServeProviderId();
    }

}
